package com.examplemartin.jpademo.pojo.po;

import com.examplemartin.jpademo.annotation.EntityCheck;
import com.examplemartin.jpademo.pojo.admin.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.io.Serializable;

/**
 * 用户表
 */

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "t_menu")
public class MenuPO extends BaseEntity implements Serializable {

    @EntityCheck(required = true, errRequired = "必须输入菜单名")
    private String menuname;

    private String url;
    private String icon;

    @ManyToOne()
//  @JoinColumn(name = "parent_id")
    private MenuPO parent;

//  @OneToMany(mappedBy = "parent")
//  @JsonIgnoreProperties({"hibernateLazyInitializer","handler","fieldHandler","parent"})
//  private List<MenuPO> child;

    private int position;

    private String comment;

    private Boolean display;

    @Override
    public String toString() {
        return "MenuPO{" +
                "menuname='" + menuname + '\'' +
                ", url='" + url + '\'' +
                ", icon='" + icon + '\'' +
                ", position=" + position +
                ", comment='" + comment + '\'' +
                ", display=" + display +
                '}';
    }
}
